package com.seednia.foundation.framework.util;

import com.seednia.foundation.framework.dto.AbstractRecord;
import com.seednia.foundation.framework.dto.Constants;

public class RecordUtils {

	public static final void initCriteria(AbstractRecord record)
	{
		record.setSid(Constants.SID_ANY);
		record.setCreateDt(null);
	}

	public static final boolean isSidPositive(Long sid)
	{
		if (sid != null && sid > 0)
			return true;
		return false;
	}

	public static final boolean isSidPositive(AbstractRecord record)
	{
		if (record != null && isSidPositive(record.getSid()))
			return true;
		return false;
	}

	public static final boolean isSidNil(Long sid)
	{
		if (sid == null || sid == Constants.SID_NIL)
			return true;
		return false;
	}

	public static final boolean isSidNil(AbstractRecord record)
	{
		if (record == null || record.getSid() == null || record.getSid() == Constants.SID_NIL)
			return true;
		return false;
	}
	
	public static final boolean isSidAny(Long sid)
	{
		if (sid == null || sid == Constants.SID_ANY)
			return true;
		return false;
	}
	
	
	public static final boolean isNotEmpty(String val)
	{
		if (val != null && val.trim().length() > 0)
			return true;
		return false;
	}
}
